package Swing;

import javax.swing.*;
import java.awt.*;

public class TestCombobox_Demo02 extends JFrame {
    public TestCombobox_Demo02() {
        Container contentPane = this.getContentPane();
        //生成列表内容
        String[] contents = {"张三","李四","张飞","小明","小红","小金"};
        //列表中需要放入内容
        JList list = new JList(contents);

        contentPane.add(list);
        setVisible(true);
        setSize(500,500);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {

        new TestCombobox_Demo02();
    }
}
